
#include <iostream>
#include <string>
#include <unistd.h>

using namespace std;
class Channel
{
public:
    Channel(int wfd, pid_t id)
        : _wfd(wfd), _id(id)
    {
        _name = "Channel-" + to_string(wfd) + "-" + to_string(id);
    }
    void SendTask(int cmd)
    {
        write(_wfd, &cmd, sizeof(cmd));
    }
    ~Channel()
    {
    }
    string Name()
    {
        return _name;
    }
    void Close()
    {
        close(_wfd);
    }
    pid_t ID()
    {
        return _id;
    }
    int wfd()
    {
        return _wfd;
    }

private:
    int _wfd;
    std::string _name;
    pid_t _id;
};
